package pt.mauromad.guias.bean;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

import pt.mauromad.guias.dao.AddressDao;
import pt.mauromad.guias.refdata.DocumentType;
import pt.mauromad.guias.utils.DateUtils;

public class ManifestBean {
	private Long id;

	@NotNull
	private DocumentType documentType;

	@NotNull
	private AddressDao originAddress;

	@NotNull
	private AddressDao destinationAddress;

	@NotNull
	private AddressDao shippingAddress;

	@NotNull
	private AddressDao deliveryAddress;

	@NotNull
	@Pattern(regexp = "[A-Z0-9]{2}-[A-Z0-9]{2}-[A-Z0-9]{2}")
	private String vehicleId;

	@NotNull
	private Date startDate;

	@NotNull
	private Date endDate;

	@NotNull
	private List<ItemBean> items = new ArrayList<>();

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public DocumentType getDocumentType() {
		return documentType;
	}

	public void setDocumentType(DocumentType documentType) {
		this.documentType = documentType;
	}

	public AddressDao getOriginAddress() {
		return originAddress;
	}

	public void setOriginAddress(AddressDao originAddress) {
		this.originAddress = originAddress;
	}

	public AddressDao getDestinationAddress() {
		return destinationAddress;
	}

	public void setDestinationAddress(AddressDao destinationAddress) {
		this.destinationAddress = destinationAddress;
	}

	public AddressDao getShippingAddress() {
		return shippingAddress;
	}

	public void setShippingAddress(AddressDao shippingAddress) {
		this.shippingAddress = shippingAddress;
	}

	public AddressDao getDeliveryAddress() {
		return deliveryAddress;
	}

	public void setDeliveryAddress(AddressDao deliveryAddress) {
		this.deliveryAddress = deliveryAddress;
	}

	public String getVehicleId() {
		return vehicleId;
	}

	public void setVehicleId(String vehicleId) {
		this.vehicleId = vehicleId;
	}

	public Date getStartDate() {
		return startDate;
	}

	public String getStartDateStr() {
		return DateUtils.convertDateTime(getStartDate());
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public String getEndDateStr() {
		return DateUtils.convertDateTime(getEndDate());
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public List<ItemBean> getItems() {
		return items;
	}

	public void setItems(List<ItemBean> items) {
		this.items = items;
	}
}
